package com.cloudcross.ssp.web.back.main;

import com.cloudcross.ssp.base.web.SimpleController;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 控制面板功能。
 * 首页控制
 *
 * @author wuqiang.du
 */
@Controller("back.dashboardController")
@RequestMapping("/back/main/dashboard")
public class DashboardController extends SimpleController {

    @RequestMapping
    public String index(Model model) {
        /**
         * 后端首页输出的是所有媒体的总的pv，uv，广告曝光数，广告点击数，ecpm和收入
         */
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.add(Calendar.DAY_OF_MONTH, -1);
        //今天的时间字符串
        String today = sdf.format(calendar.getTime());
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("date", today);
        return index;
    }
}